From 89a8c896633ecaf1080bf206a934f08bd477efaf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 24 Oct 2020 13:14:44 -0400 Subject: [PATCH] a11y: Improve child index helpers We need to use gtk_accessible_should_present() whenever we calculate accessible tree positions, to avoid inconsistencies. While we are at it, make these helpers usable for finding the position of accesibles that are now ignored, by not looking at should_present for the object itself. This will be relevant when we calculate the position of objects whose HIDDEN state changes. --- gtk/a11y/gtkatspicontext.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c index 2e838b1ef6..f223d13062 100644 --- a/gtk/a11y/gtkatspicontext.c +++ b/gtk/a11y/gtkatspicontext.c @@ -347,12 +347,12 @@ get_index_in_parent (GtkWidget *widget) child; child = gtk_widget_get_next_sibling (child)) { - if (!gtk_accessible_should_present (GTK_ACCESSIBLE (child))) - continue; - if (child == widget) return idx; + if (!gtk_accessible_should_present (GTK_ACCESSIBLE (child))) + continue; + idx++; } @@ -374,12 +374,12 @@ get_index_in_toplevels (GtkWidget *widget) g_object_unref (window); - if (!gtk_widget_get_visible (window)) - continue; - if (window == widget) return idx; + if (!gtk_accessible_should_present (GTK_ACCESSIBLE (window))) + continue; + idx += 1; } -- 2.30.2